package com.job.baidu;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author angzhijin
 * @Description
 * @create 2022-09-13 6:05 PM
 */

import java.util.*;
public class Baidu0913 {
    public static void main(String[] args) {

    }

    public static void B(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i--) {
            nums[i] = sc.nextInt();
            sum += nums[i];
        }

        for (int i = n-1; i >=2 ; i--) {
            int a = nums[i];
            int b = nums[i-1];
            int c = nums[i-2];
            int time = a/3;
            time = Math.min(time, b/2);
            time = Math.min(time, c);
            nums[i] -= 3*time;
            nums[i-1] -= 2*time;
            nums[i-2] -= time;
            sum -= time;
        }
        System.out.println(sum);
    }


    public static void C(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> stack = new Stack<>();
        int cur = 0;
        int res=0;
        while (sc.hasNextLine()){
            String line = sc.nextLine();
            line = line.trim();
            while (line.contains("for") && line.contains("if") && line.contains("}")){
                int index1 = line.indexOf("for");
                int index2 = line.indexOf("if");
                int index3 = line.indexOf("}");

                // 判断 "for"、"if"、 "}"  判断那个先出现，分情况处理，再截取字符串
                if((index2==-1 && index3==-1) || (index2!=-1 && index1<index2) || (index3!=-1&& index1<index3)){ // for
                    stack.push(++cur);
                    line = line.substring(index1+2);
                }else if( index2<index1){ //if
                    stack.push(-1);
                    line = line.substring(index2+2);
                }else if(index3<index1 && index3 <index2) { // "}"

                }
            }
            if(!stack.isEmpty() && line.endsWith("}")){
                int pop = stack.pop();
                if(pop!=-1)
                    cur = pop-1;
            }
        }
        System.out.println(res);
    }

    public static void A(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] line = sc.nextLine().toCharArray();
        int[] tmp = new int[26];
        int len = line.length;
        int count =0;
        for (int i = 0; i < len-5; i++) {
            char ch = line[i];
            if(ch>'a' && ch<='z' && ch!='e' && ch!='i'&& ch!='o'&& ch!='u' ){
                Arrays.fill(tmp,0);
                for (int j = 0; j < 5; j++) {
                    char ch2 = line[i+j];
                    if(tmp[ch2-'a']!=0){
                        break;
                    }
                    if(j==1 || j==2 || j==4){
                        if(ch2!='a' &&ch2!='e' && ch2!='i'&& ch2!='o'&& ch2!='u' )
                            break;

                    }else {
                        if(ch2=='a' ||ch2=='e' || ch2=='i'|| ch2=='o'|| ch2=='u' )
                            break;
                    }
                    tmp[ch2-'a']++;
                    if(j==4) count++;
                }
            }
        }
        System.out.println(count);
    }


}
